<template>
	<view>
		<u-loading-icon :show="showload"></u-loading-icon>
		<u-index-list :index-list="indexList">
				<template v-for="(item, index) in itemArr">
					<!-- #ifdef APP-NVUE -->
					<u-index-anchor :text="indexList[index]"></u-index-anchor>
					<!-- #endif -->
					<u-index-item>
						<!-- #ifndef APP-NVUE -->
						<u-index-anchor :text="indexList[index]"></u-index-anchor>
						<!-- #endif -->
						<view class="list-cell" v-for="(cell, index) in item" @click="getVal(cell)">
							{{cell}}
						</view>
					</u-index-item>
				</template>
			</u-index-list>
			
	</view>
</template>

<script>
	export default {
		data() {
			return {
				indexList: ['C', 'D','J','L','P','Q','S','W','X',],
								itemArr: [
									['成华区','崇州市'],
									['都江堰市', '大邑县'],
									['金牛区','锦江区','金堂县','简阳县'],
									['龙泉驿区'],
									['郫都区','彭州市','浦江县'],
									['青羊区','青白江区','邛崃市'],
									['双流区'],
									['武侯区','温江区'],
									['新都区','新津区']
								],
								showload:false
			};
		},
		methods:{
			//获取点击的地点改变首页搜索栏的地址
			getVal(cell){
				this.showload = true
				uni.setStorageSync('value',cell)
				setTimeout(()=>{
					uni.switchTab({
						url:'/pages/index/index',
						
					})
				},1000)
				
			}
		}
		
	}
</script>

<style lang="scss">
.list-cell {
		display: flex;
		box-sizing: border-box;
		width: 100%;
		padding: 10px 24rpx;
		overflow: hidden;
		color: #323233;
		font-size: 14px;
		line-height: 24px;
		background-color: #fff;
	}
	.u-index-anchor{
		background-color: #ebedf0 !important;
	}
	/deep/.u-loading-icon__spinner{
		position: absolute !important;
		left: 47% !important;
		top: 45% !important;
		z-index: 1;
	}
</style>
